export default {
	methods: {
		handleFocus() {
			var _that = this;
			_that.focus = false;
			setTimeout(() => {
				_that.focus = true;
			}, 500);
		},
		search() {
			var _that = this;
			_that.focus = false

			//#endregion
			// #ifdef APP-PLUS
			var mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
			mpaasScanModule.mpaasScan({
				// 扫码识别类型，参数可多选，qrCode、barCode，不设置，默认识别所有
				'scanType': ['qrCode', 'barCode'],
				// 是否隐藏相册，默认false不隐藏
				'hideAlbum': false,
				//ios需要设置这个参数，只支持中英文 zh-Hans、en，默认中文                       
				'language': 'en',
				//相册选择照片识别错误提示(ios)
				'failedMsg': '未识别到二维码，请重试',
				//Android支持全屏需要设置此参数
				'screenType': 'full'
			},
				async (ret) => {
					console.log('ret', ret)
					if (ret.resp_message == 'success') {
						_that.barCode = ret.resp_result;
						await _that.commonSearch(ret.resp_result)
					}
				})
			// #endif
			// #ifdef H5 || MP-WEIXIN || MP-QQ 
			uni.scanCode({
				scanType: ["barCode", "qrCode"],
				success: async (res) => {
					_that.barCode = res.result;
					await _that.commonSearch(res.result)
				}
			})
			// #endif
		},
		makeSound(name) {
			console.log("=====testClick=====");
			let src = '/static/' + name + '.mp3';
			//实例化声音  
			const Audio = uni.createInnerAudioContext();
			Audio.autoplay = true;
			Audio.src = src; //音频地址  
			Audio.play(); //执行播放  
			Audio.onError((res) => {
			});
			Audio.onPause(function () {
				console.log('end');
				Audio.destroy();
			});
		},
	}
};